package com.hanamaki.struct;

import java.util.Scanner;

public class While4 {

    public static void main(String[] args) {

//        录入班级人数和每位学员成绩，计算班级学员的平均成绩
        System.out.println("请输入班级人数");
        Scanner scanner = new Scanner(System.in);
        int peo = scanner.nextInt();
        System.out.println("班级一共" + peo + "人");

        int i = 1;
        int sum = 0;
        double score = 0;

        while (i <= peo) {
            System.out.println("请输入第" + i + "个人的成绩");
            score = scanner.nextDouble();
            sum += score;
            i++;
        }

        System.out.println("平均值：" + sum / peo);

        scanner.close();

    }
}
